#摄像头视频存文件#
import numpy as np
import cv2 as cv
cap=cv.VideoCapture(0)
fourcc=cv.VideoWriter.fourcc(*'XVID')
out=cv.VideoWriter('../../data/123.mp4',fourcc,20.0,(640,480))
while True:
    ret,frame=cap.read()
    if not ret:
        print("as")
        break
    out.write(frame)
    cv.imshow("frame",frame)
    if cv.waitKey(1) == ord('q'):
        break
cap.release()
out.release()
cv.destroyAllWindows()